﻿using Abp.Domain.Services;
using Newtonsoft.Json;
using shenghua.Basics.FriendlyLinks;
using shenghua.Common.FreeValues;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shenghua.Basics
{
    /// <summary>
    /// 网站基本信息
    /// </summary>
    public class WebsiteInfoManager: DomainService
    {
        private readonly FreeValueManager _freeValueManager;

        public WebsiteInfoManager(
            FreeValueManager freeValueManager)
        {
            _freeValueManager = freeValueManager;
        }

        // 企业基本信息设置
        public CompanyInfo GetCompanyInfo()
        {
            return _freeValueManager.GetValue("website.info.companyinfo", new CompanyInfo());
        }
        public Task<FreeValue> SetCompanyInfo(CompanyInfo value)
        {
            return _freeValueManager.SetValue("website.info.companyinfo", value);
        }
        // 网站基本信息设置
        public WebsiteInfo GetWebsiteInfo()
        {
            return _freeValueManager.GetValue("website.info.websiteinfo", new WebsiteInfo());
        }
        public Task<FreeValue> SetWebsiteInfo(WebsiteInfo value)
        {
            return _freeValueManager.SetValue("website.info.websiteinfo", value);
        }
        // 公司简介
        public EasyContent GetCompanyProfile()
        {
            return  _freeValueManager.GetValue("website.info.companyprofile", new EasyContent());
        }
        public Task<FreeValue> SetCompanyProfile(EasyContent value)
        {
            return _freeValueManager.SetValue("website.info.companyprofile", value);
        }
        // 企业文化
        public EasyContent GetCorporateCulture()
        {
            return _freeValueManager.GetValue("website.info.corporateculture", new EasyContent());
        }
        public Task<FreeValue> SetCorporateCulture(EasyContent value)
        {
            return _freeValueManager.SetValue("website.info.corporateculture", value);
        }
        // 荣誉资质
        public EasyContent GetHonor()
        {
            return _freeValueManager.GetValue("website.info.honor", new EasyContent());
        }
        public Task<FreeValue> SetHonor(EasyContent value)
        {
            return _freeValueManager.SetValue("website.info.honor", value);
        }
        // 关于我们
        public EasyContent GetAboutUs()
        {
            return _freeValueManager.GetValue("website.info.aboutus", new EasyContent());
        }
        public Task<FreeValue> SetAboutUs(EasyContent value)
        {
            return _freeValueManager.SetValue("website.info.aboutus", value);
        }
        // 会员公告
        public EasyContent GetUserNotice()
        {
            return _freeValueManager.GetValue("website.notice.usernotice", new EasyContent());
        }
        public Task<FreeValue> SetUserNotice(EasyContent value)
        {
            return _freeValueManager.SetValue("website.notice.usernotice", value);
        }
        // 用户协议
        public EasyContent GetUserAgreement()
        {
            return _freeValueManager.GetValue("website.notice.useragreement", new EasyContent());
        }
        public Task<FreeValue> SetUserAgreement(EasyContent value)
        {
            return _freeValueManager.SetValue("website.notice.useragreement", value);
        }
        // 联系我们
        public EasyContent GetContactUs()
        {
            return _freeValueManager.GetValue("website.notice.contactus", new EasyContent());
        }
        public Task<FreeValue> SetContactUs(EasyContent value)
        {
            return _freeValueManager.SetValue("website.notice.contactus", value);
        }

        // 首页宣传图
        public List<EasyPicture> GetAdvertisement()
        {
            return _freeValueManager.GetValue("website.home.advertisement", new List<EasyPicture>());
        }
        public Task<FreeValue> SetAdvertisement(List<EasyPicture> value)
        {
            return _freeValueManager.SetValue("website.home.advertisement", value);
        }

        // 友情链接
        public List<EasyPicture> GetFriendlyLink()
        {
            return _freeValueManager.GetValue("website.home.friendlylink", new List<EasyPicture>());
        }
        public Task<FreeValue> SetFriendlyLink(List<EasyPicture> value)
        {
            return _freeValueManager.SetValue("website.home.friendlylink", value);
        }

    }

    public class CompanyInfo
    {
        /// <summary>
        /// 企业名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 企业电话
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 企业地址
        /// </summary>
        public string Address { get; set; }
        /// <summary>
        /// QQ
        /// </summary>
        public string QQ { get; set; }
        /// <summary>
        /// 微信
        /// </summary>
        public string Weixin { get; set; }
        /// <summary>
        /// 微博
        /// </summary>
        public string Weibo { get; set; }
        /// <summary>
        /// 工作日
        /// </summary>
        public string WorkingDay { get; set; }
        /// <summary>
        /// 公司简介
        /// </summary>
        //public string CompanyProfile { get; set; }
        /// <summary>
        /// 企业文化
        /// </summary>
        //public string CorporateCulture { get; set; }
        /// <summary>
        /// 荣誉资质
        /// </summary>
        //public string Honor { get; set; }
        /// <summary>
        /// 关于我们
        /// </summary>
        //public string AboutUs { get; set; }
        /// <summary>
        /// 会员公告
        /// </summary>
        //public string UserNotice { get; set; }
        /// <summary>
        /// 用户协议
        /// </summary>
        //public string UserAgreement { get; set; }
    }

    public class WebsiteInfo
    {
        /// <summary>
        /// 网站logo
        /// </summary>
        public string Logo { get; set; }
        /// <summary>
        /// 网站名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 网站关键词
        /// </summary>
        public string Keyword { get; set; }
        /// <summary>
        /// 网站描述
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 版权
        /// </summary>
        public string Copyright { get; set; }
        /// <summary>
        /// 版权期限
        /// </summary>
        public string CopyrightTimeLimit { get; set; }
    }

    public class EasyContent
    {
        public string Picture { get; set; }
        public List<string> Pictures { get; set; }
        public string Description { get; set; }
        public string Content { get; set; }

        public EasyContent()
        {
            Pictures = new List<string>();
        }
    }

    public class EasyPicture
    {
        public string Picture { get; set; }
        public string Link { get; set; }
        public string Description { get; set; }
    }
}
